#include <iostream>
#include <fstream>
#include <vector>
#include "my_structs.h"

void up_line_raserization(const line_t& line, std::vector<cell_t>& ans)
{
	cell_t now(line.left);
	
	point_t right_point = line.right;
	point_t left_point = line.left;

	while(now.y <= right_point.y && now.x <= right_point.x)
	{
		ans.push_back(now);
		
		point_t next(now.x + 1, now.y + 1);
		int t = turn(left_point, right_point, next);
			
		if (t < 0)
			next.x--;
		if (t > 0)
			next.y--;
		
		now = cell_t(next);
	}
}

void down_line_raserisation(line_t& line, std::vector<cell_t>& ans)
{
	cell_t now(line.left);
	
	point_t right_point = line.right;
	point_t left_point = line.left;

	std::vector<cell_t> temp;

	while(now.y + 1 > right_point.y && now.x <= right_point.x)
	{
		temp.push_back(now);

		point_t next(now.x + 1, now.y);

		int t = turn(left_point, right_point, next);

		if (t > 0)
		{
			next.x--;
			next.y--;
		} else 
		{
			for (auto i = temp.rbegin(); i < temp.rend(); i++)
				ans.push_back(*i);
			temp.clear();
		}
		now = cell_t(next);
	}
	for (auto i = temp.rbegin(); i < temp.rend(); i++)
		ans.push_back(*i);
}

int main()
{
	//std::istream& in = std::cin;
	//std::ostream& out = std::cout;
	std::ifstream in("in.txt");
	std::ofstream out("out.txt");

	point_t first;
	point_t second;
	in >> first >> second;

	line_t line(first,second);
	
	std::vector<cell_t> ans;
	if (line.if_up_line())
		up_line_raserization(line,ans);
	else
		down_line_raserisation(line,ans);
	
	out << ans.size() << std::endl;
	for (std::vector<cell_t>::iterator i = ans.begin(); i < ans.end(); i++)
	{
		out << (*i) << std::endl;
	}
}